package com.waigoulin.test.service;

import com.alibaba.fastjson.JSON;
import com.waigoulin.domain.req.ShopCartReq;
import com.waigoulin.domain.res.PayOrderRes;
import com.waigoulin.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @FileName OrderServiceTest
 * @Description 订单服务接口测试
 * @Author waigoulin
 * @date 2025-07-26
 **/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderServiceTest {

    @Resource
    private IOrderService orderService;

    @Test
    public void testCreateOrder() throws Exception {
        ShopCartReq shopCartReq = ShopCartReq.builder()
                .userId("waigoulin")
                .productId("290648")
                .build();
        log.info("请求参数:{}", shopCartReq.toString());
        PayOrderRes payOrderRes = orderService.createOrder(shopCartReq);
        log.info("调试结果:{}", JSON.toJSONString(payOrderRes));
    }
}


